package isssr.bean.exception;

import java.io.Serializable;

public class InvalidPermissionException extends Exception implements
		Serializable {

	private PermissionType permissionType;

	public InvalidPermissionException(PermissionType permission)
	{
		this.permissionType  = permission;
	}
	
	public String getMessage()
	{
		return "User does not have the required permission: " + getPermissionType();
	}
	
	public String getPermissionType()
	{
		switch(this.permissionType)
		{
		case OWNER_PERMISSION :
			return "Goal Owner";
		case ENACTOR_PERMISSION : 
			return "Goal Enactor";
		case SUPER_PERMISSION :
			return "Super (Stakeholder)";
		case METRICSMGMT_PERMISSION :
			return "Metrics Manager";
		}
		
		return "None";
	}
}
